package com.itheima.day05;
/*
案例5 :方法通时获取数组最大值和最小值
 */

public class TestClassCase06 {
    public static void main(String[] args) {
        int[] num={22,44,11,55,33};

        int[] getNum = arr(num);

        System.out.println(getNum[0]);
        System.out.println(getNum[1]);
    }


    public static int[] arr(int[] arr){

        int max=arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max<=arr[i]){
               max=arr[i];
            }
        }

        int min=arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (min>=arr[i]){
                min=arr[i];
            }
        }

        int[] compareNum={min,max};

        return compareNum;


    }


}
